<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生管理系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Arial, sans-serif;
        }

        /* 头部样式 */
        .header {
            background-color: #2c3e50;
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            background-color: #3498db;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }

        /* 主体布局 */
        .container {
            display: flex;
            height: calc(100vh - 70px);
        }

        /* 左侧菜单 */
        .sidebar {
            width: 200px;
            background-color: #34495e;
            color: white;
            padding: 20px 0;
        }

        .menu-item {
            padding: 15px 20px;
            cursor: pointer;
            transition: background-color 0.3s;
            border-left: 4px solid transparent;
        }

        .menu-item:hover {
            background-color: #2c3e50;
        }

        .menu-item.active {
            background-color: #2c3e50;
            border-left: 4px solid #3498db;
        }

        /* 右侧内容区域 */
        .content {
            flex: 1;
            padding: 20px;
            background-color: #ecf0f1;
            overflow-y: auto;
        }
        #content-display{
            display: flex;
            height: 100%;
        }

        .content-frame {
            width: 100%;
            height: 100%;
            border: none;
            background-color: white;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }


        .welcome-message {
            text-align: center;
            padding: 50px;
            color: #7f8c8d;
        }
    </style>
</head>
<body>
<!-- 头部区域 -->
<div class="header">
    <h1>学生管理系统</h1>
    <div class="user-info">
        <div class="user-avatar">U</div>
        <div class="user-details">
            <div class="user-name">管理员</div>
        </div>
    </div>
</div>

<!-- 主体内容 -->
<div class="container">
    <!-- 左侧菜单 -->
    <div class="sidebar">
        <div class="menu-item active" data-target="welcome">首页</div>
        <div class="menu-item" data-target="user.html">用户管理</div>
        <div class="menu-item" data-target="class.html">班级管理</div>
        <div class="menu-item" data-target="student.html">学生管理</div>
    </div>

    <!-- 右侧内容区域 -->
    <div class="content">
        <div id="content-display">
            <div class="welcome-message">
                <h2>欢迎使用学生管理系统</h2>
                <p>请选择左侧菜单查看相应内容</p>
            </div>
        </div>
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        // 获取所有菜单项
        const menuItems = document.querySelectorAll('.menu-item');
        const contentDisplay = document.getElementById('content-display');

        // 为每个菜单项添加点击事件
        menuItems.forEach(item => {
            item.addEventListener('click', function() {
                // 移除所有菜单项的active类
                menuItems.forEach(i => i.classList.remove('active'));

                // 为当前点击的菜单项添加active类
                this.classList.add('active');

                // 获取目标内容
                const target = this.getAttribute('data-target');

                // 根据目标内容更新右侧区域
                if (target === 'welcome') {
                    contentDisplay.innerHTML = `
              <div class="welcome-message">
                <h2>欢迎使用学生管理系统</h2>
                <p>请选择左侧菜单查看相应内容</p>
              </div>
            `;
                } else {
                    contentDisplay.innerHTML = `
              <iframe src="${target}" class="content-frame"></iframe>
            `;
                }
            });
        });
    });
</script>
</body>
</html>
